package com.inossem.warehousestorage_inossem.request.inStorage.chuangyou;

import android.content.Context;
import android.text.TextUtils;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.activity.in_storage.chuangyou.CYInStorageShoppingConfirmBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageFreeConfirmBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageFreeConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.chuangyou.CYInStorageShoppingConfirmRequestBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * TODO
 *
 * @author 王斯宇
 * @time on 2018/4/2 10:23
 * @email siyu.wang@inossem.com
 */
public class CYInStorageShoppingConfirmRequest extends Request {
    public static String request(Context context, CYInStorageShoppingConfirmRequestBean paramsBean, GsonBeanListener gsonBeanListener) {
        String tag;
        String url = RequestManage.getUrl(context, RequestConstant.CY_URL_IN_STORAGE_SHOPPING_CONFIRM);
        Gson gson = new Gson();
        String params = gson.toJson(paramsBean, paramsBean.getClass());
        int method;
        method = com.android.volley.Request.Method.POST;
        tag = RequestManage.requestHttpsJsonObjectWithLoading(context, method, url, params, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                CYInStorageShoppingConfirmBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), CYInStorageShoppingConfirmBean.class);
                excuteJsonBeanNew(context, bean,gsonBeanListener);
            }
        });
        return tag;
    }
}
